<template>
  <div>
    <p>我的总资产：{{ total }}</p>
    <div>
      <p>是不是有钱人：<input type="checkbox" :checked="flag" /></p>
    </div>
    <p>目前的状态：{{ total >= 10000 ? '有钱人' : '穷光蛋' }}</p>
    <p>
      消费项目：
      <button @click="wash">洗脚60</button>
      <button @click="eat">吃饭100</button>
      <button @click="date">约会1000</button>
      <button @click="parttime">送外卖+100</button>
    </p>
  </div>
</template>
<script>
export default {
  name: 'demand-demo',
  data() {
    return {
      total: 10000,
    }
  },
  methods: {
    wash() {
      this.total -= 60
    },
    eat() {
      this.total -= 100
    },
    date() {
      this.total -= 1000
    },
    parttime() {
      this.total += 100
    },
  },
  computed: {
    flag() {
      return this.total >= 10000 ? true : false
    },
  },
}
</script>
